import { createRouter, createWebHashHistory, type RouteRecordRaw} from 'vue-router'
import { type App } from 'vue'
import RuleDemo from '@/pages/rule-demo/index.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: RuleDemo,
  }
]
export const router = createRouter({
  history: createWebHashHistory(),
  routes: routes
})
router.beforeEach((guard) => {
  // 后续需要做路由拦截
  // console.log(guard)
})

export const initRouter = (app: App<Element>) => {
  app.use(router)
}